<?php

namespace App\Listeners;

use App\Services\BaoliaoDataSyncService;
use App\Models\ModuleBaoliaoPost;

class SyncBaoliaoPostToShardedTables
{
    protected $syncService;
    
    public function __construct(BaoliaoDataSyncService $syncService)
    {
        $this->syncService = $syncService;
    }
    
    public function handle($event)
    {
        $post = $event->post;
        
        if ($post instanceof ModuleBaoliaoPost) {
            $this->syncService->syncToShardedTables($post);
        }
    }
}
